<template>
  <div class="legend2">
    <div class="legend2-left">
      <div class="marker" :style="{ backgroundColor: color }" />
      <div class="name">{{ name }}</div>
    </div>
    <div class="legend2-right">
      <div class="legend2-right-left">
        <div class="num">{{ num }}</div>
        <div class="unit">{{ unit }}</div>
      </div>
      <div class="percent">{{ percent }}</div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'Legend2',
  props: {
    name: { type: String, required: true },
    num: { type: [String, Number], required: true },
    unit: { type: String, required: true },
    color: { type: String, required: true },
    percent: { type: String, required: true }
  }
};
</script>
<style lang="scss" scoped>
.legend2 {
  height: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  &-left {
    height: 0.875rem;
    line-height: 0.875rem;
    display: flex;
    align-items: center;
    .marker {
      width: 0.3125rem;
      height: 0.3125rem;
    }
    .name {
      font-size: 0.75rem;
      color: $light2Grey;
      margin-left: 0.3125rem;
    }
  }
  &-right {
    height: 1rem;
    line-height: 1rem;
    display: flex;
    align-items: center;
    &-left {
      height: 100%;
      display: flex;
      .num {
        font-size: 0.875rem;
        color: #fff;
      }
      .unit {
        font-size: 0.75rem;
        color: $lightGrey;
        margin-left: 0.3125rem;
      }
    }
    .percent {
      width: 2.25rem;
      height: 100%;
      font-size: 0.875rem;
      text-align: right;
      color: #fff;
      margin-left: .3125rem;
    }
  }
}
</style>
